<?php
if (!defined('ABSPATH')) {
	define('ABSPATH', dirname(dirname(__FILE__)) . '/');
}

require_once ABSPATH . 'dr-config.php';
require_once ABSPATH . DRINC . '/dr-base.php';
require_once ABSPATH . DRINC . '/dr-functions.php';

require_once ABSPATH . DRINC . '/dr-page-check-login.php';

$id = dr_post('vid');
$vote_type = dr_post('type');
$owner_id = dr_post('owner_id');


$result = -1;

if (!empty($id) && !empty($vote_type) && !empty($owner_id)) {
	@list($type, $up_down) = explode('_', $vote_type);
	if ($up_down == 'up')
		$result = dr_up_vote($id, $type, $owner_id);
	else if ($up_down == 'down')
		$result = dr_down_vote($id, $type, $owner_id);
}

echo $result;
